{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">选手搜索</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form layui-form-pane" action="{:url('admin/Contestant/contestant')}" method="get">
                    <div class="layui-inline">
                        <label class="layui-form-label">排序方式</label>
                        <div class="layui-input-inline">
                            <select name="cid">
                                <option value="0">参赛时间由近及远</option>
                                <option value="1">票数有多至少</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">关键词</label>
                        <div class="layui-input-inline">
                            <input type="text" name="keyword" value="{$keyword}" placeholder="手机号/姓名" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn">搜索</button>
                    </div>
                </form>
                <hr>

                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 30px;">ID</th>
                        <th>微信名</th>
                        <th>头像</th>
                        <th>姓名</th>
                        <th>手机号</th>
                        <th>参赛作品</th>
                        <th>参加时间</th>
                        <th>当前票数</th>
                        <th>分享次数</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="player_list" item="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.nickname}</td>
                        <td><img style="width: 25px;height: 25px"  id="imgs" src="{$vo.headimgurl}" onclick="doCancel(this)"/></td>
                        <td>{$vo.playerName}</td>
                        <td>{$vo.playerMobile}</td>
                        <td>
                             {php}
                                    $imgs = explode(",",$vo['playerPic']);
                                    for($i = 0; $i < count($imgs); $i++){

                            {/php}
                            <img style="width: 25px;height: 25px"  id="imgss" src="http://sml.lfmall.net{$imgs[$i]}" onclick="doCancels(this)"/>
                            {php}
                                     }
                            {/php}
                        </td>
                        <td>{$vo.createTime}</td>
                        <td>{$vo.currentNum}</td>
                        <td>{$vo.shareNum}</td>
                        <td>{php}echo $vo['status']==1 ? '通过' : '未通过';{/php} / {php}echo $vo['isLock']==0 ? '未锁定' : '已锁定';{/php}</td>
                        <td>
                            <a href="{:url('admin/Contestant/update',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">票数调整</a>
                            {switch name="vo.isLock"}
                                {case value="0"}
                                    <a href="{:url('admin/Contestant/status',['id'=>$vo['id'],'isLock'=>$vo['isLock']])}" class="layui-btn layui-btn-normal layui-btn-mini ajax-update" >
                                        锁定
                                    </a>
                                {/case}
                                {case value="1"}
                                        <a href="{:url('admin/Contestant/status',['id'=>$vo['id'],'isLock'=>$vo['isLock']])}" class="layui-btn layui-btn-normal layui-btn-mini ajax-update" style="background: red">
                                            解锁
                                        </a>
                                {/case}
                        {/switch}
                            <a href="{:url('admin/Contestant/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                            <a href="{:url('admin/Contestant/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                <!--分页-->
                {$player_list->render()}
            </div>
        </div>
    </div>
    <div id="imgManager" style="margin: auto;width: 200px;height: 200px;display: none;position:fixed;top:25%;left:50%;">
        <img  id="ims" style="width: 200px;height: 200px;" src="xxx" onclick="goCancel(this)"/>
    </div>
</div>
<script type="text/javascript">
    function doCancel(obj){
        $("#imgManager").css("display","block");
        $("#ims").attr({
            "src": obj.src
        })
    }

    function doCancels(obj){
        $("#imgManager").css("display","block");
        $("#ims").attr({
            "src": obj.src
        })
    }

    function goCancel(){
        $("#imgManager").css("display","none");
    }
</script>
{/block}